package com.jo.test;

import com.jo.annotation.After;
import com.jo.annotation.Aspect;
import com.jo.annotation.Before;
import com.jo.anotation.MyAutoWire;
import com.jo.anotation.MyComponent;

/**
 * @author Jo
 * @date 2018/1/24
 */
@MyComponent
@Aspect
public class TimeHandler {

    @MyAutoWire
    private SimpleDao simpleDao;

    @Before(targets = {"dao"})
    public void printCurTime(){
        System.out.println("before simpleDao.hello:");
        simpleDao.hello();
        System.out.println("before当前时间：" + System.currentTimeMillis());
    }

    @After(targets = {"dao"})
    public void printTime(){
        System.out.println("after当前时间：" + System.currentTimeMillis());
        System.out.println("after simpleDao.hello:");
        simpleDao.hello();
    }
}
